package entity

import (
	"time"

	"shqsoft.cn/pasnj/base"
	//	log "github.com/sirupsen/logrus"
)

// UserSel 用户
type UserSel struct {
	ID             int          `gorm:"AUTO_INCREMENT;primary_key;column:ID"`
	No             string       `gorm:"column:SysUserID;size:10"`
	OrganizationID *int         `gorm:"column:OrganID"`
	Organization   Organization `gorm:"ForeignKey:OrganizationID"`
	Name           string       `gorm:"column:SysUserName;size:20"`
	Memo           string       `gorm:"column:SysUserMemo;size:500"`
	EMail          string       `gorm:"column:EMail;size:60"`
	Telephone      string       `gorm:"column:Telephone;size:30"`
	PositionID     int          `gorm:"column:Position"`
	Position       Position     `gorm:"ForeignKey:PositionID"`
	SerialID       int          `gorm:"column:Serial"`
	Serial         Serial       `gorm:"ForeignKey:SerialID"`
	Sex            string       `gorm:"column:SSEX;size:1"`
	SexCaption     string       `gorm:"-"`
	IsPublic       bool         `gorm:"column:ISPU"`
	RoleIds        string       `gorm:"column:RoleIds;size:100"`
	RoleCaptions   string       `gorm:"-"`
	Birthday       *time.Time   `gorm:"column:Birthday;type:date;"`
	NameCaption    string       `gorm:"-"`
	ISLSGHR        int          `gorm:"column:ISLSGHR"`

	// YWID           *int         `gorm:"column:YWTX"`
	// YWTX           YWTX         `gorm:"ForeignKey:YWID"`
}

// TableName YONGHU
func (UserSel) TableName() string {
	return "V_SysUser_Sel"
}

// UserSelEF 返回结构体
func UserSelEF() base.EntityFunc {
	return func() interface{} {
		entity := UserSel{}
		return &entity
	}
}

// UserSelESF 返回结构体数组
func UserSelESF() base.EntitiesFunc {
	return func() interface{} {
		var entities []UserSel
		return &entities
	}
}

func init() {
	relationship := []string{"Organization", "Position", "Serial"}
	base.DaoPoolObj.Put("UserSel", base.NewDefaultDao(UserSelEF(), UserSelESF(), relationship))
}
